﻿//使用说明界面内容
void Widget::initContentPage0() {
    //设置按钮 start
    Button* button0_1 = new Button(width - 65, 0, 65, 35, L"返回上一页", [&]() {  });
    button0_1->setSecondPosition(width - 65, 0, 130, 70);
    addButton(0, button0_1);
    //设置按钮 end


    //设置文字 start
    OutTextXY* out0_0 = new OutTextXY(80, 50, L"传入的txt文件格式说明（若csv文件则用空格隔开）：", 20);
    addouttextxy(0, out0_0);
    OutTextXY* out0_1 = new OutTextXY(105, 75, L"第一行输入n和m，二者用空格隔开", 20);
    out0_1->setSecondPosition(105, 75, 19);
    addouttextxy(0, out0_1);

    OutTextXY* out0_2 = new OutTextXY(105, 102, L"接下来的n行中，每行给出x1 y1 x2 y2（代表一条飞行线的两个端点，空格隔开）", 20);
    addouttextxy(0, out0_2);

    OutTextXY* out0_3 = new OutTextXY(105, 122, L"接下来m行中，每行给出x y（代表查询点的坐标，空格隔开）", 20);
    addouttextxy(0, out0_3);

    OutTextXY* out0_4 = new OutTextXY(105, 172, L"传入的数据将自动保留到小数点后至多两位", 20);
    addouttextxy(0, out0_4);
    //设置文字 end
}
//主界面内容(进程序第一个界面)
void Widget::initContentPage1() {
    //设置按钮 start
    Button* button1_1 = new Button(265, 155, 165, 27, L"运行", [&]() {   });
    button1_1->setSecondPosition(530, 310, 330, 55);   //大窗口坐标
    addButton(1, button1_1);

    Button* button1_2 = new Button(265, 190, 165, 27, L"不用文件，直接输入", [&]() {   });
    button1_2->setSecondPosition(530, 310, 330, 55);//大窗口坐标 
    addButton(1, button1_2);

    Button* button1_3 = new Button(530, 117, 35, 19, L"清空", [&]() {    });
    button1_3->setSecondPosition(1060, 235, 70, 38);//小窗口坐标
    addButton(1, button1_3);

    Button* button1_4 = new Button(width - 65, 35, 65, 35, L"使用说明", [&]() {    });
    button1_4->setSecondPosition(width - 65, 35, 65, 35);
    addButton(1, button1_4);

    Button* button1_5 = new Button(width - 65, 0, 65, 35, L"全屏", [&]() {});
    addButton(1, button1_5);

    Button* button1_6 = new Button(570, 117, 100, 19, L"保存为默认路径", [&]() {  });

    addButton(1, button1_6);
    //设置按钮 end

    //设置文字 start
    OutTextXY* out1_1 = new OutTextXY(145, 119, L"文件路径:", 18);
    addouttextxy(1, out1_1);

    OutTextXY* out1_2 = new OutTextXY(235, 72, L"⽆⼈机最近⻜⾏线查询系统", 27);
    addouttextxy(1, out1_2);

    OutTextXY* out1_3 = new OutTextXY(235, 230, L"tips: 可 ctrl+c 直接复制文件，然后 ctrl+v 粘贴", 17);//tips1: 支持 .txt和.csv文件，支持 ctrl+v 粘贴文本
    addouttextxy(1, out1_3);


//设置文字 end


//设置文本输入框 start
    //在界面1创建文本框1        输入文件路径
    TextBox* textbox1_1 = new TextBox(200, 117, 320, 21, 50);
});


}
//运行界面 内容
void Widget::initContentPage2() {
    //设置按钮 start
    {
        Button* button2_1 = new Button(width - 65, 0, 65, 35, L"返回上一页", [&]() { });
        addButton(2, button2_1);
        Button* button2_2 = new Button(width - 135, 90, 75, 35, L"添加飞行线", [&]() {  });
        addButton(2, button2_2);

        Button* button2_3 = new Button(width - 135, 135, 75, 35, L"删除飞行线", [&]() {     });
        addButton(2, button2_3);

        Button* button2_4 = new Button(width - 135, 180, 75, 35, L"绘制图像", [&]() { });
        addButton(2, button2_4);
    }
    //设置按钮 end

    //设置表格 start
        //查看答案
    TableWidget* table2_1 = new TableWidget(40, 40, 450, 330, 12, false, 0.5);
    addTable(2, table2_1);
    //设置表格 end

}
//添加飞行线界面内容
void Widget::initContentPage3() {
    //设置按钮 starts
    Button* button3_1 = new Button(width - 65, 0, 65, 35, L"返回上一页", [&]() {   });
    addButton(3, button3_1);

    Button* button3_2 = new Button(575, 245, 65, 33, L"添加", [&]() {   });
    addButton(3, button3_2);

    //设置按钮 end

    //设置文字 start
    {
        //端点1 x坐标
        OutTextXY* out3_1 = new OutTextXY(535, 113, L"端点1  x坐标 :", 18);
        addouttextxy(3, out3_1);
        //端点1 y坐标
        OutTextXY* out3_2 = new OutTextXY(535, 143, L"端点1  y坐标 :", 18);
        addouttextxy(3, out3_2);
        //端点2 x坐标                       
        OutTextXY* out3_3 = new OutTextXY(535, 173, L"端点2  x坐标 :", 18);
        addouttextxy(3, out3_3);
        //端点2 y坐标                       
        OutTextXY* out3_4 = new OutTextXY(535, 203, L"端点2  y坐标 :", 18);
        addouttextxy(3, out3_4);
        //提示数量
        OutTextXY* out3_5 = new OutTextXY(535, 80, L"请输入飞行线端点坐标", 20);
        addouttextxy(3, out3_5);
        //飞行线数量
        OutTextXY* out3_6 = new OutTextXY(width - 155, 60, L"", 18);
        addouttextxy(3, out3_6);
    }
    //设置文字 end


    //设置文本输入框 start
        TextBox* textbox3_1 = new TextBox(615, 112, 65, 22, 8);//  端点1 X
        TextBox* textbox3_2 = new TextBox(615, 142, 65, 22, 8);//  端点1 Y
        TextBox* textbox3_3 = new TextBox(615, 172, 65, 22, 8);//  端点2 X
        TextBox* textbox3_4 = new TextBox(615, 202, 65, 22, 8);//  端点2 Y
    //设置文本输入框 end


    //设置表格 start
        //添加飞行线界面
        TableWidget* table3_1 = new TableWidget(40, 40, 450, 330, 12, false, 0.5);
        addTable(3, table3_1);
    //设置表格 end
}
//删除飞行线界面内容  
void Widget::initContentPage4() {
    //设置按钮 start
    {
        Button* button4_1 = new Button(width - 65, 0, 65, 35, L"返回上一页", [&]() {    });
        addButton(4, button4_1);
        Button* button4_2 = new Button(575, 245, 65, 33, L"删除", [&]() { });
        addButton(4, button4_2);
    }
    //设置按钮 end

    //设置文字 start
    {
        OutTextXY* out4_1 = new OutTextXY(width - 155, 60, L"当前飞行线数量:", 18);
        addouttextxy(4, out4_1);
        //飞行线数量

        OutTextXY* out4_2 = new OutTextXY(width - 575, 375, L"tips:点击想要删除的飞行线后，点删除按钮，即可删除", 18);
        addouttextxy(4, out4_2);
    }
    //设置文字 end

    //设置表格 start
    
        //删除 飞行线界面
        TableWidget* table4_1 = new TableWidget(40, 40, 450, 330, 12, true, 0.5);
        addTable(4, table4_1);
    
    //设置表格 end
}
//绘制图像界面内容   
void Widget::initContentPage5() {
    //设置按钮 start
    Button* button5_1 = new Button(0, height - 45, 124, 45, L"返回上一页", [&]() { });
    addButton(5, button5_1);
    Button* button5_2 = new Button(91, 251, 33, 30, L"搜索", [&]() {  });
    addButton(5, button5_2);
    Button* button5_3 = new Button(0 * 0.5, 281, 124, 30, L"显示/隐藏该飞行线", [&]() {  });
    addButton(5, button5_3);
    //设置按钮 end

    //设置文字 start
    if (width == screenWidth * 2) {
        OutTextXY* out5_1 = new OutTextXY(2, 315, L"操作说明:", 12, L"宋体", RGB(64, 64, 64));
        addouttextxy(5, out5_1);
        OutTextXY* out5_2 = new OutTextXY(2, 325, L"- 鼠标滚轮缩放图表", 12, L"宋体", RGB(64, 64, 64));
        addouttextxy(5, out5_2);
        OutTextXY* out5_3 = new OutTextXY(2, 335, L"- 左键拖动平移:", 12, L"宋体", RGB(64, 64, 64));
        addouttextxy(5, out5_3);
        OutTextXY* out5_4 = new OutTextXY(2, 345, L"- 点击查询点可到达对应的位置:", 12, L"宋体", RGB(64, 64, 64));
        addouttextxy(5, out5_4);
        OutTextXY* out5_5 = new OutTextXY(2, 355, L"  并显示其到达最近飞行线的距离", 12, L"宋体", RGB(64, 64, 64));
        addouttextxy(5, out5_5);
        OutTextXY* out5_6 = new OutTextXY(2, 365, L"- 再次点击将取消距离的显示", 12, L"宋体", RGB(64, 64, 64));
        addouttextxy(5, out5_6);
    }

    //设置文字 end

    TextBox* textbox5_1 = new TextBox(0, 251, 124, 30, 4);
    textbox5_1->setDefaultText(L"输入飞行线序号", 12);
    textbox5_1->setNextField(textbox5_1);
    textbox5_1->setFinalCallback([button5_2]() {
        button5_2->useOnClick();
        });
    addTextBox(5, textbox5_1);

    //设置表格 start
        //绘制图形
    TableWidget* table5_1 = new TableWidget(0 , 0 , 114, 250, 10, true, 0.5, 26, 24);
    addTable(5, table5_1);

    //设置表格 end

    //设置地图  start
    plotView = PlotView(124,  // 左侧面板宽度
        width,   // 屏幕宽度
        height);   // 屏幕高度

    //设置地图  end

}
//不用文件，直接输入界面输入飞行线内容
void Widget::initContentPage6() {
    //设置按钮 start
    Button* button6_1 = new Button(width - 65, 0, 65, 35, L"返回上一页", [&]() {  });
    addButton(6, button6_1);

    Button* button6_2 = new Button(590, 245, 65, 33, L"添加", [&]() {  });
    addButton(6, button6_2);

    Button* button6_3 = new Button(590, 290, 65, 33, L"删除", [&]() {  });
    addButton(6, button6_3);

    Button* button6_4 = new Button(590, 305, 65, 33, L"下一步", [&]() {   });
    addButton(6, button6_4);
    //设置按钮 end

    //设置文字 start
    //端点1 x坐标
    OutTextXY* out6_1 = new OutTextXY(535, 113, L"端点1  x坐标 :", 18);
    addouttextxy(6, out6_1);
    //端点1 y坐标
    OutTextXY* out6_2 = new OutTextXY(535, 143, L"端点1  y坐标 :", 18);
    addouttextxy(6, out6_2);
    //端点2 x坐标
    OutTextXY* out6_3 = new OutTextXY(535, 173, L"端点2  x坐标 :", 18);
    addouttextxy(6, out6_3);
    //端点2 y坐标
    OutTextXY* out6_4 = new OutTextXY(535, 203, L"端点2  y坐标 :", 18);
    addouttextxy(6, out6_4);
    //设置文字 end


    //设置文本输入框 start
    {
        TextBox* textbox6_1 = new TextBox(615, 112, 65, 22, 8);//  端点1 X
        TextBox* textbox6_2 = new TextBox(615, 142, 65, 22, 8);//  端点1 Y
        TextBox* textbox6_3 = new TextBox(615, 172, 65, 22, 8);//  端点2 X
        TextBox* textbox6_4 = new TextBox(615, 202, 65, 22, 8);//  端点2 Y
        textbox6_1->setNextField(textbox6_2);
        textbox6_2->setNextField(textbox6_3);
        textbox6_3->setNextField(textbox6_4);
        textbox6_4->setNextField(textbox6_1);
        textbox6_4->setFinalCallback([button6_2]() {
            button6_2->useOnClick();
            });
        addTextBox(6, textbox6_1);
        addTextBox(6, textbox6_2);
        addTextBox(6, textbox6_3);
        addTextBox(6, textbox6_4);
    }
    //设置文本输入框 end

    TableWidget* table6_1 = new TableWidget(40, 40, 450, 330, 12, true, 0.5);
    addTable(6, table6_1);
}
//不用文件，直接输入界面输入查询点内容
void Widget::initContentPage7() {
    //设置按钮 start
    Button* button7_1 = new Button(width - 65, 0, 65, 35, L"返回上一页", [&]() {
        setCurrentIndex(6);
        });
    addButton(7, button7_1);

    Button* button7_2 = new Button(590, 245, 65, 33, L"添加", [&]() {     });
    addButton(7, button7_2);

    Button* button7_3 = new Button(590, 290, 65, 33, L"删除", [&]() {});
    addButton(7, button7_3);

    Button* button7_4 = new Button(590, 335, 65, 33, L"运行", [&]() { });
    addButton(7, button7_4);
    //设置按钮 end

    //设置文字 start
    //端点1 x坐标
    OutTextXY* out7_1 = new OutTextXY(535, 140, L"查询点 x坐标 :", 18);
    addouttextxy(7, out7_1);
    //端点1 y坐标
    OutTextXY* out7_2 = new OutTextXY(535, 170, L"查询点 y坐标 :", 18);
    addouttextxy(7, out7_2);
    //设置文字 end


    //设置文本输入框  
    {
        TextBox* textbox7_1 = new TextBox(615, 139, 65, 22, 8);//  端点1 X
        TextBox* textbox7_2 = new TextBox(615, 169, 65, 22, 8);//  端点2 Y
        textbox7_1->setNextField(textbox7_2);
        textbox7_2->setNextField(textbox7_1);
        textbox7_2->setFinalCallback([button7_2]() {
            button7_2->useOnClick();
            });
        addTextBox(7, textbox7_1);
        addTextBox(7, textbox7_2);
    }
    //设置文本输入框 end

    TableWidget* table7_1 = new TableWidget(40, 40, 450, 330, 12, true, 0.5);
    vector<vector<wstring>>newdata1(1);
    newdata1[0].emplace_back(L"查询点坐标");
    table7_1->setData(newdata1);
    addTable(7, table7_1);
}